#! /bin/bash 

read -p "请输入年份：" year
read -p "请输入月份：" month

if ((year%4==0&&year%100!=0))||((year%400==0)); then
    leap_year=true 
else
    leap_year=false
fi 
case $month in
    1|3|5|7|8|10|12)
        days=31
        ;;
    4|6|9|11)
        days=30
        ;;
    2)
        if $leap_year; then 
            days=29
        else 
            days=28
        fi 
        ;;
    *)
        echo "无效的月份"
        exit 1
        ;;
esac

echo "$year 年的 $month 月有 $days 天"


